struct ListNode* reverseBetween(struct ListNode* head, int left, int right) {
    struct ListNode *p=head;
    if(head==NULL)
    return NULL;
    int a[500];
    int i=0;
    int t=left;
    for(t;t>1;t--)
    {
        p=p->next;
        if(p==NULL)
        return head;

    }
    struct ListNode *q=p;
    for(left;left<=right;left++)
    {
        if(p==NULL)
        return head;
        a[i]=p->val;
        p=p->next;
        i++;
        
    }
    i=i-1;
    for(i;i>=0;i--)
    {
        q->val=a[i];
        q=q->next;
    }
    return head;
}